// TODO: 该文件是Vue路由器文件，路由管理着所有的路由
import Vue from 'vue'// 引入阉割版本的vue
import VueRouter from 'vue-router'// 引入路由插件
// TODO:引入我们需要的组件
import RegisterView from '../views/RegisterView.vue'
import ConsumerView from '../views/ConsumerView.vue'
import LoginView from '../views/LoginView.vue'
import MerchantView from '../views/MerchantView.vue'
import DelivererView from '../views/DelivererView.vue'

Vue.use(VueRouter)// 使用路由
// 创建一个路由器，管理所有的路由
const routes = [// 一堆路由。一个对象就是一个路由

    {
      path: '/',  
      name: '登录',
      component: LoginView
    },
    {
      path: '/register',  
      name: '注册',
      component: RegisterView
    },
    {
      path: '/consumer',  
      name: '用户界面',
      component: ()  => import('@/views/ConsumerView.vue')
    },
    {
      path: '/merchant/:userid',  
      name: '商家',
      component: MerchantView
    },
    {
      path: '/delivery',  
      name: '配送员界面',
      component:  ()  => import('@/views/DelivererView.vue')
    },
 
]


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
